from Tkinter import *
from client import *
from tkSimpleDialog import *

class ProjectListFrame(Frame):
    """
    Represents the frame that provides a user interface to access a project's CRCs information.
    """
    
    def __init__(self, parentControl, serverProxy):
        Frame.__init__(self, parentControl)
        self.pack()
        
        self.parentControl = parentControl
        self.serverProxy = serverProxy
        
        self.projects = serverProxy.getProjects()
        
        label = Label(self, text="Projects:")
        label.grid(sticky=N+S+E+W)

        self.classesListbox = Listbox(self)
        self.classesListbox.grid(row=1, sticky=N+S+E+W)
        for project in self.projects:
            self.classesListbox.insert(END, project.name)
        
        button = Button(self, text="Nouveau projet...", command=self.createProject)
        button.grid(row=2)
        
    def createProject(self):
        pass
        
if __name__ == "__main__":
    root = Tk()
    client = ServerProxy()
    client.createProject("Foo", "Bar", "Frob")
    client.createProject("Foo2", "Bar", "Frob")
    client.createProject("Foo3", "Bar", "Frob")
    frame = ProjectListFrame(root, client)
    root.mainloop()